<template>
  <van-nav-bar
    :title="navTitle"
    right-text="按钮"
    left-arrow
    @click-left="onClickLeft"
    @click-right="onClickRight"
  >
    <!--<van-icon name="arrow-left" slot="left" >返回2</van-icon>-->
  </van-nav-bar>
</template>

<script>
  import {NavBar, Toast,Icon} from 'vant'

  export default {
    name: "headLy",
    data(){
      return {
        navTitle:'测试'
      }
    },
    components: {
      [NavBar.name]: NavBar,
      [Toast.name]: Toast,
      [Icon.name]:Icon
    },
    computed:{
      historyLen(){
        console.log(history.length)
        return !!history.length
      }
    },
    mounted(){
      this.navTitle = this.$route.name
    },
    updated(){
      console.log('update')
      this.navTitle = this.$route.name
    },
    methods: {
      onClickLeft() {
        this.$router.go(-1)
      },
      onClickRight() {
        Toast('按钮')
      }
    }
  }
</script>

<style scoped>

</style>
